<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>
<script>
//21-05-19-傍晚-北京海淀-北京电视台 

//default很简单，意思就是默认值
//调用animal()方法时忘了传参数，传统的做法就是加上这一句type = type || 'cat' 来指定默认值。
function animal(type){
    type = type || 'cat'  
    console.log(type)
}
animal();
//换es6的写法 
function animal(type = 'cat'){
    console.log(type)
}
animal()

//rest语法 
function animals(...types){
    console.log(types)
}
animals('cat', 'dog', 'fish') //["cat", "dog", "fish"]



</script>